# -*- coding: utf-8 -*-
# @Time : 2024/2/1 17:14
# @Author : ZH
# @File : 69.py
# @Software: PyCharm
class Solution:
    def mySqrt(self, x: int) -> int:
        r = x
        l = 0
        res = -1
        while r >= l:
            mid = (r+l) // 2
            if mid * mid <= x:
                res = mid
                l = mid + 1

            else:
                r = mid - 1
        return res


if __name__ == '__main__':
    x = 29792276
    so = Solution()
    z = so.mySqrt(x=x)
    print(z)
